import React, { Component } from 'react';
import { Text, TextInput, View } from 'react-native';

/**
 * TextInput输入组件
 */
export default class PizzaTranslator extends Component {
    // 构造方法
    constructor(props) {
        super(props);
        this.state = {text: ''};
    }

    render() {
        return(
            <View style={{padding: 10}}>
                <TextInput
                    style={{height: 40}}
                    placeholder="Type here to translate"
                    onChangeText={(text) => this.setState({text})}
                />
                <Text style={{padding: 10, fontSize: 42}}>
                    {this.state.data.split(' ').map((word) => word && "🍕").join(' ')}
                </Text>
            </View>
        )
    }
}
